//引入axios
import request from '@/utils/request'

//引入类型
import type { trademarkResponseData,trademark } from './model/trademark'

//枚举地址链接
enum API {
   TRADEMARK='/admin/product/baseTrademark',
   ADDTRADEMARK = '/admin/product/baseTrademark/save',
   UPDATETRADEMARK = '/admin/product/baseTrademark/update',
   DELETETRADEMARK = '/admin/product/baseTrademark/remove/'
}

//获取品牌数据
export const reqTrademark = (page:number,limit:number) => request.get<any,trademarkResponseData>(API.TRADEMARK + `/${page}/${limit}`)

//修改或添加接口
export const reqAddOrUpdateTradeMark = (data:trademark) => {
   if(data.id){
      //修改数据
      return request.put<any,any>(API.UPDATETRADEMARK,data)
   }else{
      //添加数据
      return request.post<any,any>(API.ADDTRADEMARK,data)
   }
};

//删除数据
export const reqDeleteTradeMark = (id:number) =>request.delete<any,any>(API.DELETETRADEMARK+id)